module.exports = class StockRequest {
	/**
	      ==数据提取网(新浪财经)==
	      http://vip.stock.finance.sina.com.cn/mkt/#hs_a
	      ==接口 ======
		   **code直接拼接后面**
	      http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData
	      ==参数=======
		  {		**页码**
		    	page: 1,
				**页数**
		    	num: 40,
				**排序字段**
		    	sort: symbol,
				**倒序**
		    	asc: 1,
				**模块**
				**[sh_a:沪A,sh_b:沪B,sz_a:深A,sz_b:深B,hs_a:沪深A,hs_b沪深B]**
		    	node: sh_a,
		    	symbol: 
		    	_s_r_a: "init"
		   }
	      ==响应数据类型==
	       Content-Type: text/html; charset=UTF-8
	      ==响应数据====
	     	[
				{
				 **标识**
				"symbol": "sh600000",
				**编码**
				"code": "600000",
				**名称**
				"name": "浦发银行",
				**最新价**
				"trade": "10.230",
				**涨跌额**
				"pricechange": 0.01,
				**涨跌幅(0.098%)**
				"changepercent": 0.098,
				**买入**
				"buy": "10.230",
				**卖出**
				"sell": "10.240",
				**昨收**
				"settlement": "10.220",
				**开盘价**
				"open": "10.210",
				**最高价**
				"high": "10.320",
				**最低价**
				"low": "10.180",
				 **成交量(手)**
				"volume": 52244908,
				**成交额(万)**
				"amount": 535599653,
				**时间**
				"ticktime": "15:00:00",
				**市盈率**
				"per": 5.441,
				**市净率**
				"pb": 0.55,
				**市值**
				"mktcap": 30027243.733476,
				"nmc": 30027243.733476,
				**换手率**
				"turnoverratio": 0.17799
				}
	     	]
	      */
	static getBaseInfoForStock(params = {}) {
		return uniCloud.httpclient.request(
			"http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData", {
				data: {
					page: 1,
					num: 1,
					sort: 'symbol',
					asc: 1,
					node: "",
					symbol: "",
					_s_r_a: "page",
					...params

				},
				method: "get",
				dataType: "json"
			})
	}

	/**
		
	    ==数据提取网(腾讯证券)==
	    https://gu.qq.com/sz000100/gp
	    ==接口 ======
	    https://proxy.finance.qq.com/ifzqgtimg/appstock/app/newfqkline/get
	    ==参数=======
	    {
	     (sz000100 : 股票编码 | day : k线类型 |2004-01-01:开始年月日| 2005-12-31:结束年月日 | [320,640] : 数据量  )
	     (默认一年数据 : param=sz000100,day,,,960)
	     param="sz000100,[day,week,month],2004-01-01,2005-12-31,640,qfq", 
	     }
	    ==响应数据类型==
	     Content-Type: text/html; charset=UTF-8
	    ==响应数据====
	   	 data:{
	   		 "sz000100":{
	   			 "[qfqday,qfqweek,qfqmonth]":[
	   				 [	 
	   					 "2021-06-02", 当前日期
	   					 "8.15", 开盘价
	   					 "8.01", 收盘价
	   					 "8.16", 最高价
	   					 "8.00", 最低价
	   					 "2764520.00", 成交量(手)
	   					 {},
	   					 "2.14", 换手率
	   					 "222394.00", 成交额
	   					 ""
	   				 ]
	   			 ]
	   		 }
	   	 }
	    */

	// 日，周，月线
	static  getLineForStock({
		symbol = "",
		type = "day",
		start = "",
		end = "",
		cycle = "0"
	} = {}, params = {}, context = {}) {
		return uniCloud.httpclient.request(
		"https://proxy.finance.qq.com/ifzqgtimg/appstock/app/newfqkline/get", {
			data: {
				param: `${symbol},${type},${start},${end},${cycle},qfq`,
				...params
			},
			method: "get",
			dataType: "json"
		})
	}

	/**
		  ==数据提取网(新浪财经)==
		  http://vip.stock.finance.sina.com.cn/mkt/#hs_a
		  ==接口 ======
		  http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeStockCount
		  ==参数=======、
		  {	  	
			  **模块**
			  [sh_a:沪A,sh_b:沪B,sz_a:深A,sz_b:深B,hs_a:沪深A,hs_b沪深B]
			  node=sh_a
		   }
		  ==响应数据类型==
		   Content-Type: text/html; charset=UTF-8
		  ==响应数据====
		 	"1898"
		  */
	static  getTotalByNodeForStock(node = "") {
		return  uniCloud.httpclient.request(
			"http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeStockCount ", {
				data: {
					node,
				},
				method: "get",
				dataType: "json"
			})
	}
	
	


}
